package com.wuyou.sso.common.enums;

import cn.hutool.core.util.EnumUtil;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.wuyou.sso.common.annotation.DictValue;
import com.wuyou.sso.common.annotation.Label;
import com.wuyou.sso.common.annotation.MapDict;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 开票类型
 *
 * @author lishangbu
 * @date 2021/2/23
 */
@RequiredArgsConstructor
@MapDict(code = "bill-type",name = "开票类型")
public enum BillTypeEnum implements IEnum<Integer> {
    /**
     * 数电
     */
    @Label("数电")
    SD(0, "数电"),
    /**
     * 电普
     */
    @Label("电普")
    DP(1, "电普");

    /**
     * 类型
     */
    @DictValue
    private final Integer type;

    /**
     * 描述
     */
    @JsonValue
    @Getter
    private final String description;

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static BillTypeEnum getEnum(Object value) {
        return EnumUtil.likeValueOf(BillTypeEnum.class, value);
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

}
